package com.dengwei.smali.first.dwpull_to_refresh.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.dengwei.smali.first.dwpull_to_refresh.R;

/**
 * Created by dengwei on 2017/3/19.
 */

public class Demo2Adapter extends BaseAdapter {
    private Context context;
    public String[] data;
    public Demo2Adapter(Context context, String[] data){
        this.context = context;
        this.data = data;
    }
    @Override
    public int getCount() {
        return data.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(context).inflate(R.layout.item_layout,null);
        TextView tv = (TextView) view.findViewById(R.id.tv_item);
        tv.setText(data[i]);
        return view;
    }
}
